﻿using Microsoft.Extensions.DependencyInjection;
using MvcSample.Data.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace MvcSample.Data
{
    public class ApplicationContextSeed
    {
        public async Task SeedAsync(ApplicationContext ctx)
        {
            if (!ctx.Student.Any())
            {
                await ctx.Student.AddAsync(new Student("建", "张", new DateTime(1993, 3, 8)));
                await ctx.SaveChangesAsync();
            }
        }
    }
}
